#!/usr/bin/env node

const fs = require('fs'),
      src = process.argv[2],
      uid = Number(process.argv[3]),
      gid = Number(process.argv[4]);
if(process.argv.length != 5){
  console.error('命令行参数不正确，请重新输入！');
  process.exit(0);
}else if(!fs.existsSync(src)){
  console.error(`${src} is not exist, please check your answer`);
  process.exit(1);
}
try{
  fs.chownSync(src,uid,gid);
}catch(e){
  console.error(e.message);
  process.exit(2);
}
